package com.yundong.gongchengji.base;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * 基础fragment
 * Created by ls on 2017/2/21.
 */

public abstract class BaseFragment extends Fragment {


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(getRootView(), null);
        initView(view);
        initVariable();
        processLogic(savedInstanceState);
        return view;
    }

    public abstract int getRootView();

    public abstract void initView(View view);
    /**
     * 初始化变量
     */
    protected abstract void initVariable();

    /**
     * 处理业务逻辑，状态恢复等操作
     */
    protected abstract void processLogic(Bundle savedInstanceState);
}
